import { Component, OnInit } from '@angular/core';
import { NzModalService } from 'ng-zorro-antd';
import { Router, NavigationEnd } from '@angular/router';
import { filter } from 'rxjs/operators';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html'
})
export class AppComponent implements OnInit {

  title = 'cloud-music';

  constructor(
    private router: Router,
    private modalService: NzModalService
  ) { }

  ngOnInit(): void {
    this.router.events.pipe(filter(evt => evt instanceof NavigationEnd))
      .subscribe(() => {
        this.modalService.closeAll();
      });
  }

}
